package com.zwps.biz.controller.http;

import com.zwps.biz.api.model.vo.forecast.LatestForecastVO;
import com.zwps.biz.api.model.vo.forecast.RainfallForecastVO;
import com.zwps.biz.api.model.vo.pubpointall.CalculationVO;
import com.zwps.biz.domain.service.ForecastService;
import com.zwps.biz.domain.service.impl.ForecastServiceImpl;
import com.zwps.common.controller.response.message.ResponseDataMessage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("brief/forecast")
@RestController
@Tag(name = "预报查询")
public class ForecastController {
    @Autowired
    ForecastService forecastService;

    @Operation(summary = "雨水情预报查询")
    @GetMapping("rainfall_forecast")
    public RainfallForecastVO getRainfallForecast() {
        return forecastService.getRainfallForecast();
    }
    @Operation(summary = "最新洪水预报结果")
    @GetMapping("lastest_forecast")
    public LatestForecastVO getLatestForecastResult() {
        return forecastService.getLatestForecastResult();
    }

    @Operation(summary = "获取预演方案")
    @GetMapping("rehearsal_plan")
    public ResponseDataMessage getForecastResult(@Valid @NotBlank String startTime, @Valid @NotBlank String endTime) {
        return ResponseDataMessage.data(forecastService.getRehearsalPlanList(startTime, endTime));
    }
    @Operation(summary = "雨情实时预报")
    @GetMapping("getRealTimeRain")
    public ResponseDataMessage getRealTimeRain() {
        return ResponseDataMessage.data(forecastService.getRealTimeRain());
    }
    @Operation(summary = "雨情历史预报")
    @GetMapping("getHisTimeRain")
    public Map<String, Object> getHisTimeRain() {
        return forecastService.getHisTimeRain();
    }
    @Operation(summary = "水情实时预报")
    @GetMapping("getRealTimWater")
    public ResponseDataMessage getRealTimWater() {
        return ResponseDataMessage.data(forecastService.getRealTimeWater());
    }
    @Operation(summary = "水情历史预报")
    @GetMapping("getHisTimeWater")
    public Map<String, Object> getHisTimeWater() {
        return forecastService.getHisTimeWater();
    }
    @Operation(summary = "下泄实时预报")
    @GetMapping("getFloodDsp")
    public ResponseDataMessage getFloodDsp() {
        return ResponseDataMessage.data(forecastService.getFloodDsp());
    }

    @Operation(summary = "下泄历史预报")
    @GetMapping("getHisFloodDsp")
    public Map<String, Object> getHisFloodDsp() {
        return forecastService.getHisFloodDsp();
    }

    @Operation(summary = "工程安全预警")
    @GetMapping("getBriefWaring")
    public List<CalculationVO> getBriefWaring() {
        return forecastService.getBriefWaring();
    }
}
